    //
//  RegisterViewSelectController.m
//  iOsiris-v2
//
//  Created by Admin on 20-01-11.
//  Copyright 2011 Bedrijf. All rights reserved.
//

#import "RegisterViewSelectController.h"
#import "Database.h"

@implementation RegisterViewSelectController

@synthesize date;
@synthesize time;
@synthesize period;
@synthesize location;
@synthesize courseId;
@synthesize course;
@synthesize description;

- (IBAction) btnCancel:(id) sender
{
	[self.view removeFromSuperview];
}

- (IBAction) registerForTest:(id) sender 
{
	
	NSLog(@"Click button");
	// get de DBAccess Object
	Database *database = [[Database alloc] init];
	
	[database registerTheCourse:courseId];
	
	//close the database
	[database closeDatabase];
	
	//release the database to free memory
	[database release];
	[self.parentViewController <UITableViewDelegate, UITableViewDataSource> reloadData];
	[self.view removeFromSuperview];

}

- (void) setLabels: (Course *) theCourse {
	self.course = theCourse;
}


 // The designated initializer.  Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
        // Custom initialization
    }
    return self;
}

/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
}
*/


// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
	date.text = course.date;
	time.text = course.time;
	period.text = course.period;
	location.text = course.location;
	description.text = course.description;
	self.courseId = course.courseId;
    [super viewDidLoad];
}


/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/

- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (void)dealloc {
    [date release];
	[time release];
	[period release];
	[location release];
	[course release];
	[description release];
	[super dealloc];
}

@end
